{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "f6d8d21c-8f57-4109-8716-8fb8bbe4e9ff",
   "metadata": {},
   "outputs": [],
   "source": [
    "x = 123"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ab6c4330-dc94-464a-ad19-3ade87f33dac",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "14401a08-b90b-4f07-9dbf-87dd77d6ad22",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "f61da7c4-afb7-4612-9065-70f8276cef12",
   "metadata": {},
   "outputs": [],
   "source": [
    "class Student:\n",
    "    def __init__(self, name, age):\n",
    "        self.name = name\n",
    "        self.age = age\n",
    "    \n",
    "    def introduce(self):\n",
    "        print(f\"您好, 我是{self.name}，{self.age:0.0f}岁\")\n",
    "\n",
    "s1 = Student('张三', 19)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "b973c3c3-71b4-4b21-97f3-43f281c33b46",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<__main__.Student at 0x7f7e70309e10>"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Student(name='张三', age=19)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "875142c4-3c57-4eb6-9087-012e4fc691d4",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "张三 李四\n"
     ]
    }
   ],
   "source": [
    "s1 = Student('张三', 19)\n",
    "s2 = Student('李四', 20)\n",
    "\n",
    "print(s1.name, s2.name)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "b938b1fe-89e3-435a-a7f9-1002d98d0564",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "您好, 我是张三，19岁\n",
      "您好, 我是李四，20岁\n"
     ]
    }
   ],
   "source": [
    "s1.introduce()\n",
    "s2.introduce()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "0c3a7569-552c-48e2-a3ee-af8cace26bcc",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'张三'"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s1.name"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
